/*
 * @desc:
 * @author: mao
 * @version: 1.0
 * @Date: 2023-08-11 09:07:47
 */
import request from '../service/axios'
// 获取机构id
// const { userInfo } = window.microApp.getGlobalData();
export const tempUrl = async () => {
    // const res = await request({
    //     url: `/usersys-auth/user-info/get-org-users/${userInfo.orgId}`,
    //     method: "get",
    // });
    return 'res.data.result.data';
};

// 送审人
export const getSubmitters = async (obj: any) => {
    const res = await request({
        url: `/workflow/mediaInfo/getSubmitters`,
        method: "post",
        data: obj,
    });
    return res.data.result.data;
};

// 媒资栏目
export const mediaColumn = async () => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/column/selection`,
        method: "get",
    });
    return res.data.result.data;
};

// 标注栏目
export const initColumn = async () => {
    const res = await request({
        url: `/mediaresourcelib-base-lib/column/selection`,
        method: "get",
    });
    return res.data.result.data;
};

// 审核标注-表单初始化
export const initBiaozhuFn = async (id: string) => {
    const res = await request({
        url: `/mediaresource-manage-service/medias/${id}/association`,
        method: "get",
    });
};

// 通过
export const passBiaozhuFn = async (obj: any) => {
    const res = await request({
        url: `/workflow/mediaInfo/pass`,
        method: "post",
        data: obj,
    });
};

//   const flagResult = await axios({
//       method: "post",
//       url: that.host + "/handsome-ai-helper/client/conversation",
//       headers: {
//           authorization: localStorage.getItem("authorization"),
//       },
//       data: {
//           taskId: Number(that.value),
//           message: that.anDesc,
//           listId: that.currentId == "" ? "" : that.currentId,
//       },
//   });

// 搜索接口
export const search = (data: any) => {
    return request({
        url: `/multimodal-search-service/mediaresource/search`,
        method: "post",
        data,
    });
};

// 找相似
export const getSimilar = (data: any) => {
    return request({
        url: `/multimodal-search-service/mediaresource/similar/${data.id}`,
        method: "post",
        data: data,
    });
};

// 审核找相似
export const getSimilarmedias = (data: any) => {
    return request({
        url: `/multimodal-search-service/mediaresource/similarmedias/${data.id}`,
        method: "post",
        data: data,
    });
};

// 离开解锁
export const leaveUnlock = (data?: any) => {
    return request({
        url: `/workflow/mediaInfo/unlockOfUser`,
        method: "post",
        data: data || { businessIds: [] },
    });
};
// 锁
export const lockUser = (data: any) => {
    return request({
        url: `/workflow/mediaInfo/lockOfUser`,
        method: "post",
        data: data,
    });
};

// 消息列表
export const getMessage = (data: any) => {
    return request({
        url: `/messagecenter/user-message/get-list`,
        method: "post",
        data: data,
    });
};

// 帮助文档
export const getHelp = (data: any) => {
    return request({
        url: `/mediaresourcelib-common-cms/content/getList`,
        method: "get",
        data: data,
    });
};

// 代办审核
export const getCheck = (data: any) => {
    return request({
        url: `/workflow/userMediaInfo/getList`,
        method: "post",
        data: data,
    });
};

// 使用情况
export const usageTable = (data: any) => {
    return request({
        url: `/mediaresourcelib-datastatistics-service/mediaResource/usage`,
        method: "get",
        params: data,
    });
};

// 媒资占比
export const typeProportion = () => {
    return request({
        url: `/mediaresourcelib-datastatistics-service/mediaResource/typeProportion`,
        method: "get",
    });
};

// 媒资数据
export const mediaResourceData = (data: any) => {
    return request({
        url: `/mediaresourcelib-datastatistics-service/mediaResource/mediaResourceData`,
        method: "get",
    });
};

// 头部数据
export const headData = () => {
    return request({
        url: `/mediaresourcelib-datastatistics-service/mediaResource/title`,
        method: "get",
    });
};

// 工作台数据
export const workSearchData = () => {
    return request({
        url: `/mediaresourcelib-datastatistics-service/mediaResource/normal/title`,
        method: "get",
    });
};

// 热词搜索
export const hotWordList = () => {
    return request({
        url: `/multimodal-search-service/mediaresource/hotwords`,
        method: "get",
    });
};

// 公司列表
export const orgsList = (id: string) => {
    return request({
        url: `/mediaresourcelib-alliancemanagement-service/company/getCompanyIdAndName?orgId=${id}`,
        method: "get",
    });
};

// 栏目查询
export const columnById = (orgId: string) => {
    return request({
        url: `/mediaresourcelib-base-lib/column/getColumnByOrgId?orgId=${orgId}`,
        method: "get",
    });
};

// 操作记录
export const getMediaInfoLog = (data: any) => {
    return request({
        method: "get",
        url: `/mediaresourcelib-alliancemanagement-service/log/mediaOperateLog?mediaId=${data.id}`,
    });
};

// 媒资统计
export const TypeNumCount = (data?: any) => {
    let urlStr=data['key']?`&${data.key}=${data['val'].id}`:"";
    return request({
        method: "get",
        url: data.type == 1
            ? `/mediaresource-manage-service/mediaStatistic/numberOfTypes?type=1${urlStr}`
            : `/mediaresource-manage-service/mediaStatistic/numberOfTypes?type=2`,
    });
};

// 回收站媒资统计
export const TypeNumRecycleCount = (id?: string) => {
    return request({
        method: "get",
        url: id
            ? `/mediaresourcelib-datastatistics-service/business/getRecycleTypeNum?id=${id}`
            : `/mediaresourcelib-datastatistics-service/business/getRecycleTypeNum`,
    });
};

// 来源
export const selectOrigin = (id?: string) => {
    return request({
        method: "get",
        url: "/mediaresourcelib-base-lib/column/select",
    });
};

// 置灰列表
export const uploadGray = (data: any) => {
    return request({
        method: "get",
        url: `/mediaresourcelib-file-manager/resource/process/files?location=${data.location}&parent_id=${data.parent_id}`,
    });
};

// 获取分辨率列表
export const widthList = (id: string) => {
    return request({
        method: "get",
        url: `/mediaresourcelib-file-manager/resource/file/width/${id}`,
    });
};

// 下载水印图片
export const downloadMark = (data: any) => {
    return request({
        method: "post",
        url: `/mediaresourcelib-file-manager/resource/files/url/width`,
        data: data,
    });
};


// 交易信息
export const goodsDetail = (data: any) => {
    return request({
        method: "post",
        url: `/mediaresourcelib-trade-platform-business/goods/detail`,
        data: data,
    });
};
